﻿<Window
    x:Class="ParsecVDisplay.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ParsecVDisplay"
    xmlns:components="clr-namespace:ParsecVDisplay.Components"
    mc:Ignorable="d"

    Icon="app.ico"
    WindowStyle="None"
    BorderThickness="0"
    Width="800" Height="450"
    ResizeMode="NoResize"
    
    WindowStartupLocation="CenterScreen"
    Loaded="Window_Loaded"
    Unloaded="Window_Unloaded"
>
    <Grid MouseDown="Grid_MouseDown">
        <Grid.Background>
            <ImageBrush ImageSource="Resources/background.png"/>
        </Grid.Background>

        <Label x:Name="xNoDisplay" Content="Add a virtual display first!" Foreground="#AAA" FontSize="16"
            HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,183,0,0" />

        <WrapPanel x:Name="xDisplays" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="20,0,20,52">
            <components:DisplayItem />
        </WrapPanel>

        <StackPanel x:Name="xButtons" Margin="0,0,25,25"  Orientation="Horizontal" Height="36" VerticalAlignment="Bottom" HorizontalAlignment="Right">
            <components:Button FontSize="14" Width="40" Click="OpenSettings">
                <components:Button.Children>
                    <Image Source="Resources/settings.png" Width="24" Height="24" />
                </components:Button.Children>
            </components:Button>

            <components:Button FontSize="14" Width="40" Margin="10,0,0,0" Click="SyncSettings">
                <components:Button.Children>
                    <Image Source="Resources/sync.png" Width="24" Height="24" />
                </components:Button.Children>
            </components:Button>

            <components:Button Click="OpenCustom" Children="CUSTOM..." FontSize="14" Margin="10,0,0,0" Width="100" />
            <components:Button x:Name="xAdd" Click="AddDisplay" Children="ADD DISPLAY" FontSize="14" Margin="25,0,0,0" Width="120"  />
        </StackPanel>

        <StackPanel Margin="25,0,0,20" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="230">
            <StackPanel Orientation="Horizontal">
                <Image Source="app.ico" Width="20" Height="18" Margin="0,0,5,0" />
                <Label x:Name="xAppName" Content="ParsecVDisplay" FontSize="14" Cursor="Hand" MouseDown="QueryStatus">
                    <Label.Style>
                        <Style TargetType="Label">
                            <Setter Property="Foreground" Value="White" />
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Foreground" Value="#66b3ff" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Label.Style>
                </Label>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/github.png" Width="20" Height="20" Margin="0,0,5,0" />
                <Label Content="@github/parsec-vdd" FontSize="14" Cursor="Hand" MouseDown="OpenRepoLink">
                    <Label.Style>
                        <Style TargetType="Label">
                            <Setter Property="Foreground" Value="White" />
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Foreground" Value="#66b3ff" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Label.Style>
                </Label>
            </StackPanel>
        </StackPanel>

        <Frame Visibility="Hidden" NavigationUIVisibility="Hidden" Background="#C222" x:Name="xFrame" />
        <components:CloseButton Width="48" Height="30" HorizontalAlignment="Right" VerticalAlignment="Top" />
    </Grid>
    
    <Window.ContextMenu>
        <ContextMenu>
            <MenuItem Header="{x:Static local:App.NAME}" Click="QueryStatus">
                <MenuItem.Icon>
                    <Image Source="app.ico" />
                </MenuItem.Icon>
            </MenuItem>
            <Separator />
            <MenuItem Header="Add display" Click="AddDisplay" />
            <MenuItem Header="Remove last display" Click="RemoveLastDisplay" />
            <Separator />
            <MenuItem Header="Run on startup" IsCheckable="True" IsChecked="{Binding Path=(local:Config.RunOnStartup), Mode=TwoWay}" />
            <MenuItem Header="Fallback display" IsCheckable="True" IsChecked="{Binding Path=(local:Config.FallbackDisplay), Mode=TwoWay}" />
            <MenuItem Header="Keep screen on" IsCheckable="True" IsChecked="{Binding Path=(local:Config.KeepScreenOn), Mode=TwoWay}" />
            <Separator />
            <MenuItem Header="Exit" Click="ExitApp" />
        </ContextMenu>
    </Window.ContextMenu>
</Window>